<%@page import="java.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/bootstrap.min.css">
<title></title>
<%
	//创建链接字符串
	//jdbc:数据库类型://主机/数据库名?user=root&oasswoed=密码
	String url="jdbc:mysql://localhost/studetdb?user=root&password=888888";
	//加载驱动
	Class.forName("com.mysql.jdbc.Driver");
	//3.创建链接对象
	Connection conn=DriverManager.getConnection(url);
	//4.创建对象Statement，用于执行SQl语句
	Statement stat=conn.createStatement();
	//5.创建SQL语句
	String sql="SELECT * FROM student";
	//6.执行SQL语句，调用executeQuery语句
	ResultSet rs=stat.executeQuery(sql);
%>
</head>
<body>
 <div class="content">
        <table class="table table-bordered table-striped">
            <tr>
                <th>学号</th>
                <th>姓名</th>
                <th>出生日期</th>
                <th>所在班级</th>
                <th>操作</th>
            </tr>
            <%while(rs.next()){ %>
            <tr>
                <td><%=rs.getString(1) %></td>
                <td><%=rs.getString("stuname") %></td>
                <td><%=rs.getString(3) %></td>
                <td><%=rs.getString(4) %></td>
                <td></td>
            </tr>
            <%} %>
        </table>
    </div>
    <script src="js/bootstrap.min.js"></script>

</body>
</html>